//
//  HTWeComeView.swift
//  weibo
//
//  Created by JonsonLiu on 2017/3/9.
//  Copyright © 2017年 JonsonLiu. All rights reserved.
//

import UIKit

class HTWeComeView: UITableViewCell {
    //头像
    @IBOutlet weak var iconView: UIImageView!
    //名字
    @IBOutlet weak var nameLable: UILabel!
    //vip
    @IBOutlet weak var memberIconView: UIImageView!
    //时间
    @IBOutlet weak var timeLable: UILabel!
    //来源
    @IBOutlet weak var sourceLbale: UILabel!
    //VIP
    @IBOutlet weak var vipIconView: UIImageView!
    //正文
    @IBOutlet weak var stateusLable: UILabel!
    
    
    @IBOutlet weak var toolBar: TabtoolsView!
    
    //转发微博名字
    @IBOutlet weak var retweenLable: UILabel?
    
    @IBOutlet weak var priceView: HTPriceView!
    
    
    var stateModel : StatesViewModel?{
    
        didSet{
//            guard  let url = stateModel?.states?.user?.profile_image_url,
//                let urlString  = URL(string:url) else {
//                return
//            }
//            iconView.sd_setImage(with: urlString, placeholderImage: UIImage(named: "avatar_default_small"))
//            iconView.cz_setImage(urlString: stateModel?.states?.user?.profile_image_url, placeholderImage: UIImage(named: "avatar_default_small"))
            iconView.ht_setImage(urlString: stateModel?.states?.user?.profile_image_url, placeholderImage: UIImage(named: "avatar_default_small"), isAvatar: true)
            
            nameLable.text = stateModel?.states?.user?.name
            
            memberIconView.image = stateModel?.memberImage
            
            sourceLbale.text = stateModel?.sourceText
            stateusLable.text = stateModel?.states?.text
            
            toolBar.viewModel = stateModel
            
            priceView.priceView.constant = stateModel?.prictureSize.height ?? 0
            priceView.urls = stateModel?.picURLS
            
            retweenLable?.text = stateModel?.retweetText
        }
    
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
    }
    
    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
    }
    
   

}
